package cn.findviewbydream.evil.main.enums;

/********************************************
 * 工程名：HebeuCS
 * 包名：cn.findviewbydream.evil.main.emu
 * 时间：16-10-30 下午10:11
 * 作者：白雨濃 evil
 * 邮箱：evilbai@foxmail.com
 * 内容：访问类型
 ********************************************/
public enum AccessType
{
    PC(1, "PC端访问", true),
    MOBILE(-1, "移动端访问", false),
    PC_IE(-2, "PC-IE端访问", false);

    private int index;
    private String name;
    private boolean state;

    AccessType(int index, String name, boolean state)
    {
        this.index = index;
        this.name = name;
        this.state = state;
    }

    public static String getName(int index)
    {
        for (AccessType typeEnum : AccessType.values())
            if (typeEnum.getIndex() == index)
                return typeEnum.name;
        return null;
    }

    public static boolean getState(int index)
    {
        for (AccessType typeEnum : AccessType.values())
            if (typeEnum.getIndex() == index)
                return typeEnum.state;
        return false;
    }


    public int getIndex()
    {
        return index;
    }

    public String getName()
    {
        return name;
    }

    public boolean isState()
    {
        return state;
    }
}
